<?php
  include("include/conn.php");
  require('include/Smarty/libs/Smarty.class.php');

  $msg = "";

  if(isset($_POST['submit']) && $_POST['kaarigarName'] == '')
  {
   $msg = "<center><div class='clean-gray'>Enter Kaarigar Name ...!!!</div></center><br/>";
  }
  if(isset($_POST['kaarigarName']) && $_POST['kaarigarName'] != '')
  {
    $insertQueryKaarigarName = "insert into kaarigar (kaarigarName) values ('".$_POST['kaarigarName']."')";
    $insertQueryKaarigarNameResult = mysql_query($insertQueryKaarigarName);
    if(!$insertQueryKaarigarNameResult)
    {
      die("Insert Query Not Inserted : ".mysql_error());
    }
	  else
	  {
	    header("Location:kaarigarList.php");
	  }
  }
  $smarty = new Smarty;
  require('bottom.php');
  $smarty->assign("l_addKaarigar",$l_addKaarigar);
  $smarty->assign("l_kaarigarName",$l_kaarigarName);

  $smarty->assign("msg",$msg);
  $smarty->display('addKaarigar.tpl');
?>